﻿using System;
using System.Collections.Generic;

namespace SharpSqlAnalyzer.nodes
{
	// Token: 0x020002B2 RID: 690
	public class TCTEList : TParseTreeNodeList
	{
		// Token: 0x170004DD RID: 1245
		// (get) Token: 0x06001767 RID: 5991 RVA: 0x003280DC File Offset: 0x003262DC
		// (set) Token: 0x06001768 RID: 5992 RVA: 0x003280E4 File Offset: 0x003262E4
		public Dictionary<string, TCTE> CTEDict
		{
			get
			{
				return this._cteDict;
			}
			set
			{
				this._cteDict = value;
			}
		}

		// Token: 0x0600176A RID: 5994 RVA: 0x00328100 File Offset: 0x00326300
		public virtual void addCTE(TCTE cte)
		{
			base.addElement(cte);
			try
			{
				this._cteDict.Add(TBaseType.getTextWithoutQuoted(cte.TableName.ToString()).ToUpper(), cte);
			}
			catch (ArgumentException)
			{
				Console.WriteLine("A CTE with name = {0} already exists.", TBaseType.getTextWithoutQuoted(cte.TableName.ToString()).ToUpper());
			}
		}

		// Token: 0x0600176B RID: 5995 RVA: 0x0032816C File Offset: 0x0032636C
		public virtual TCTE getCTE(int position)
		{
			if (position < base.size())
			{
				return (TCTE)this.elementAt(position);
			}
			return null;
		}

		// Token: 0x0600176C RID: 5996 RVA: 0x00328185 File Offset: 0x00326385
		internal override void addParseTreeNode(object arg1)
		{
			this.addCTE((TCTE)arg1);
		}

		// Token: 0x0600176D RID: 5997 RVA: 0x00328193 File Offset: 0x00326393
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x0600176E RID: 5998 RVA: 0x003281A4 File Offset: 0x003263A4
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			for (int i = 0; i < base.size(); i++)
			{
				this.getCTE(i).acceptChildren(v);
			}
			v.postVisit(this);
		}

		// Token: 0x0400180A RID: 6154
		private Dictionary<string, TCTE> _cteDict = new Dictionary<string, TCTE>();
	}
}
